<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>misc</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/androguard/">Androguard</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Module&nbsp;misc
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="misc-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="misc-module.html">Module misc</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-comment"># This file is part of Androguard.</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-comment"># Copyright (C) 2010, Anthony Desnos &lt;desnos at t0t0.org&gt;</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt>  <tt class="py-line"><tt class="py-comment"># All rights reserved.</tt> </tt>
<a name="L5"></a><tt class="py-lineno"> 5</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L6"></a><tt class="py-lineno"> 6</tt>  <tt class="py-line"><tt class="py-comment"># Androguard is free software: you can redistribute it and/or modify</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt>  <tt class="py-line"><tt class="py-comment"># it under the terms of the GNU Lesser General Public License as published by</tt> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt>  <tt class="py-line"><tt class="py-comment"># the Free Software Foundation, either version 3 of the License, or</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt>  <tt class="py-line"><tt class="py-comment"># (at your option) any later version.</tt> </tt>
<a name="L10"></a><tt class="py-lineno">10</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L11"></a><tt class="py-lineno">11</tt>  <tt class="py-line"><tt class="py-comment"># Androguard is distributed in the hope that it will be useful,</tt> </tt>
<a name="L12"></a><tt class="py-lineno">12</tt>  <tt class="py-line"><tt class="py-comment"># but WITHOUT ANY WARRANTY; without even the implied warranty of</tt> </tt>
<a name="L13"></a><tt class="py-lineno">13</tt>  <tt class="py-line"><tt class="py-comment"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</tt> </tt>
<a name="L14"></a><tt class="py-lineno">14</tt>  <tt class="py-line"><tt class="py-comment"># GNU Lesser General Public License for more details.</tt> </tt>
<a name="L15"></a><tt class="py-lineno">15</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L16"></a><tt class="py-lineno">16</tt>  <tt class="py-line"><tt class="py-comment"># You should have received a copy of the GNU Lesser General Public License</tt> </tt>
<a name="L17"></a><tt class="py-lineno">17</tt>  <tt class="py-line"><tt class="py-comment"># along with Androguard.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</tt> </tt>
<a name="L18"></a><tt class="py-lineno">18</tt>  <tt class="py-line"> </tt>
<a name="L19"></a><tt class="py-lineno">19</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">types</tt><tt class="py-op">,</tt> <tt class="py-name">random</tt><tt class="py-op">,</tt> <tt class="py-name">string</tt> </tt>
<a name="L20"></a><tt class="py-lineno">20</tt>  <tt class="py-line"> </tt>
<a name="L21"></a><tt class="py-lineno">21</tt>  <tt class="py-line"><tt id="link-0" class="py-name" targets="Variable misc.ANDROGUARD_VERSION=misc-module.html#ANDROGUARD_VERSION"><a title="misc.ANDROGUARD_VERSION" class="py-name" href="#" onclick="return doclink('link-0', 'ANDROGUARD_VERSION', 'link-0');">ANDROGUARD_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"b0"</tt> </tt>
<a name="L22"></a><tt class="py-lineno">22</tt>  <tt class="py-line"> </tt>
<a name="L23"></a><tt class="py-lineno">23</tt>  <tt class="py-line"><tt id="link-1" class="py-name" targets="Variable misc.ANDROAXML_VERSION=misc-module.html#ANDROAXML_VERSION"><a title="misc.ANDROAXML_VERSION" class="py-name" href="#" onclick="return doclink('link-1', 'ANDROAXML_VERSION', 'link-1');">ANDROAXML_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"0.1"</tt> </tt>
<a name="L24"></a><tt class="py-lineno">24</tt>  <tt class="py-line"><tt id="link-2" class="py-name" targets="Variable misc.ANDRODD_VERSION=misc-module.html#ANDRODD_VERSION"><a title="misc.ANDRODD_VERSION" class="py-name" href="#" onclick="return doclink('link-2', 'ANDRODD_VERSION', 'link-2');">ANDRODD_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"0.1"</tt> </tt>
<a name="L25"></a><tt class="py-lineno">25</tt>  <tt class="py-line"><tt id="link-3" class="py-name" targets="Variable misc.ANDRODIFF_VERSION=misc-module.html#ANDRODIFF_VERSION"><a title="misc.ANDRODIFF_VERSION" class="py-name" href="#" onclick="return doclink('link-3', 'ANDRODIFF_VERSION', 'link-3');">ANDRODIFF_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"0.1"</tt> </tt>
<a name="L26"></a><tt class="py-lineno">26</tt>  <tt class="py-line"><tt id="link-4" class="py-name" targets="Variable misc.ANDROSIM_VERSION=misc-module.html#ANDROSIM_VERSION"><a title="misc.ANDROSIM_VERSION" class="py-name" href="#" onclick="return doclink('link-4', 'ANDROSIM_VERSION', 'link-4');">ANDROSIM_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"0.1"</tt> </tt>
<a name="L27"></a><tt class="py-lineno">27</tt>  <tt class="py-line"><tt id="link-5" class="py-name" targets="Variable misc.ANDRODUMP_VERSION=misc-module.html#ANDRODUMP_VERSION"><a title="misc.ANDRODUMP_VERSION" class="py-name" href="#" onclick="return doclink('link-5', 'ANDRODUMP_VERSION', 'link-5');">ANDRODUMP_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"0.1"</tt> </tt>
<a name="L28"></a><tt class="py-lineno">28</tt>  <tt class="py-line"><tt id="link-6" class="py-name" targets="Variable misc.ANDROLYZE_VERSION=misc-module.html#ANDROLYZE_VERSION"><a title="misc.ANDROLYZE_VERSION" class="py-name" href="#" onclick="return doclink('link-6', 'ANDROLYZE_VERSION', 'link-6');">ANDROLYZE_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"0.2"</tt> </tt>
<a name="L29"></a><tt class="py-lineno">29</tt>  <tt class="py-line"><tt id="link-7" class="py-name" targets="Variable misc.ANDROMARKS_VERSION=misc-module.html#ANDROMARKS_VERSION"><a title="misc.ANDROMARKS_VERSION" class="py-name" href="#" onclick="return doclink('link-7', 'ANDROMARKS_VERSION', 'link-7');">ANDROMARKS_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"0.1"</tt> </tt>
<a name="L30"></a><tt class="py-lineno">30</tt>  <tt class="py-line"><tt id="link-8" class="py-name" targets="Variable misc.ANDROXGMML_VERSION=misc-module.html#ANDROXGMML_VERSION"><a title="misc.ANDROXGMML_VERSION" class="py-name" href="#" onclick="return doclink('link-8', 'ANDROXGMML_VERSION', 'link-8');">ANDROXGMML_VERSION</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"0.1"</tt> </tt>
<a name="L31"></a><tt class="py-lineno">31</tt>  <tt class="py-line"> </tt>
<a name="L32"></a><tt class="py-lineno">32</tt>  <tt class="py-line"> </tt>
<a name="L33"></a><tt class="py-lineno">33</tt>  <tt class="py-line"> </tt>
<a name="L34"></a><tt class="py-lineno">34</tt>  <tt class="py-line"> </tt>
<a name="Color"></a><div id="Color-def"><a name="L35"></a><tt class="py-lineno">35</tt> <a class="py-toggle" href="#" id="Color-toggle" onclick="return toggle('Color');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="misc.Color-class.html">Color</a><tt class="py-op">:</tt> </tt>
</div><div id="Color-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="Color-expanded"><a name="L36"></a><tt class="py-lineno">36</tt>  <tt class="py-line">    <tt id="link-9" class="py-name" targets="Variable misc.Color.normal=misc.Color-class.html#normal"><a title="misc.Color.normal" class="py-name" href="#" onclick="return doclink('link-9', 'normal', 'link-9');">normal</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[0m"</tt> </tt>
<a name="L37"></a><tt class="py-lineno">37</tt>  <tt class="py-line">    <tt id="link-10" class="py-name" targets="Variable misc.Color.black=misc.Color-class.html#black"><a title="misc.Color.black" class="py-name" href="#" onclick="return doclink('link-10', 'black', 'link-10');">black</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[30m"</tt> </tt>
<a name="L38"></a><tt class="py-lineno">38</tt>  <tt class="py-line">    <tt id="link-11" class="py-name" targets="Variable misc.Color.red=misc.Color-class.html#red"><a title="misc.Color.red" class="py-name" href="#" onclick="return doclink('link-11', 'red', 'link-11');">red</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[31m"</tt> </tt>
<a name="L39"></a><tt class="py-lineno">39</tt>  <tt class="py-line">    <tt id="link-12" class="py-name" targets="Variable misc.Color.green=misc.Color-class.html#green"><a title="misc.Color.green" class="py-name" href="#" onclick="return doclink('link-12', 'green', 'link-12');">green</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[32m"</tt> </tt>
<a name="L40"></a><tt class="py-lineno">40</tt>  <tt class="py-line">    <tt id="link-13" class="py-name" targets="Variable misc.Color.yellow=misc.Color-class.html#yellow"><a title="misc.Color.yellow" class="py-name" href="#" onclick="return doclink('link-13', 'yellow', 'link-13');">yellow</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[33m"</tt> </tt>
<a name="L41"></a><tt class="py-lineno">41</tt>  <tt class="py-line">    <tt id="link-14" class="py-name" targets="Variable misc.Color.blue=misc.Color-class.html#blue"><a title="misc.Color.blue" class="py-name" href="#" onclick="return doclink('link-14', 'blue', 'link-14');">blue</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[34m"</tt> </tt>
<a name="L42"></a><tt class="py-lineno">42</tt>  <tt class="py-line">    <tt id="link-15" class="py-name" targets="Variable misc.Color.purple=misc.Color-class.html#purple"><a title="misc.Color.purple" class="py-name" href="#" onclick="return doclink('link-15', 'purple', 'link-15');">purple</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[35m"</tt> </tt>
<a name="L43"></a><tt class="py-lineno">43</tt>  <tt class="py-line">    <tt id="link-16" class="py-name" targets="Variable misc.Color.cyan=misc.Color-class.html#cyan"><a title="misc.Color.cyan" class="py-name" href="#" onclick="return doclink('link-16', 'cyan', 'link-16');">cyan</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[36m"</tt> </tt>
<a name="L44"></a><tt class="py-lineno">44</tt>  <tt class="py-line">    <tt id="link-17" class="py-name" targets="Variable misc.Color.grey=misc.Color-class.html#grey"><a title="misc.Color.grey" class="py-name" href="#" onclick="return doclink('link-17', 'grey', 'link-17');">grey</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[37m"</tt> </tt>
<a name="L45"></a><tt class="py-lineno">45</tt>  <tt class="py-line">    <tt id="link-18" class="py-name" targets="Variable misc.Color.bold=misc.Color-class.html#bold"><a title="misc.Color.bold" class="py-name" href="#" onclick="return doclink('link-18', 'bold', 'link-18');">bold</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[1m"</tt> </tt>
<a name="L46"></a><tt class="py-lineno">46</tt>  <tt class="py-line">    <tt id="link-19" class="py-name" targets="Variable misc.Color.uline=misc.Color-class.html#uline"><a title="misc.Color.uline" class="py-name" href="#" onclick="return doclink('link-19', 'uline', 'link-19');">uline</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[4m"</tt> </tt>
<a name="L47"></a><tt class="py-lineno">47</tt>  <tt class="py-line">    <tt id="link-20" class="py-name" targets="Variable misc.Color.blink=misc.Color-class.html#blink"><a title="misc.Color.blink" class="py-name" href="#" onclick="return doclink('link-20', 'blink', 'link-20');">blink</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[5m"</tt> </tt>
<a name="L48"></a><tt class="py-lineno">48</tt>  <tt class="py-line">    <tt id="link-21" class="py-name" targets="Variable misc.Color.invert=misc.Color-class.html#invert"><a title="misc.Color.invert" class="py-name" href="#" onclick="return doclink('link-21', 'invert', 'link-21');">invert</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"\033[7m"</tt> </tt>
</div><a name="L49"></a><tt class="py-lineno">49</tt>  <tt class="py-line"> </tt>
<a name="long2int"></a><div id="long2int-def"><a name="L50"></a><tt class="py-lineno">50</tt> <a class="py-toggle" href="#" id="long2int-toggle" onclick="return toggle('long2int');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="misc-module.html#long2int">long2int</a><tt class="py-op">(</tt> <tt class="py-param">l</tt> <tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
</div><div id="long2int-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="long2int-expanded"><a name="L51"></a><tt class="py-lineno">51</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">l</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">0x7fffffff</tt> <tt class="py-op">:</tt> </tt>
<a name="L52"></a><tt class="py-lineno">52</tt>  <tt class="py-line">        <tt class="py-name">l</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-number">0x7fffffff</tt> <tt class="py-op">&amp;</tt> <tt class="py-name">l</tt><tt class="py-op">)</tt> <tt class="py-op">-</tt> <tt class="py-number">0x80000000</tt> </tt>
<a name="L53"></a><tt class="py-lineno">53</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">l</tt> </tt>
</div><a name="L54"></a><tt class="py-lineno">54</tt>  <tt class="py-line"> </tt>
<a name="long2str"></a><div id="long2str-def"><a name="L55"></a><tt class="py-lineno">55</tt> <a class="py-toggle" href="#" id="long2str-toggle" onclick="return toggle('long2str');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="misc-module.html#long2str">long2str</a><tt class="py-op">(</tt><tt class="py-param">l</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="long2str-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="long2str-expanded"><a name="L56"></a><tt class="py-lineno">56</tt>  <tt class="py-line">    <tt class="py-docstring">"""Convert an integer to a string."""</tt> </tt>
<a name="L57"></a><tt class="py-lineno">57</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt id="link-22" class="py-name" targets="Variable dvm.MAP_ITEM_NAMEDTUPLE.type=dvm.MAP_ITEM_NAMEDTUPLE-class.html#type"><a title="dvm.MAP_ITEM_NAMEDTUPLE.type" class="py-name" href="#" onclick="return doclink('link-22', 'type', 'link-22');">type</a></tt><tt class="py-op">(</tt><tt class="py-name">l</tt><tt class="py-op">)</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-op">(</tt><tt class="py-name">types</tt><tt class="py-op">.</tt><tt class="py-name">IntType</tt><tt class="py-op">,</tt> <tt class="py-name">types</tt><tt class="py-op">.</tt><tt class="py-name">LongType</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L58"></a><tt class="py-lineno">58</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">,</tt> <tt class="py-string">'the input must be an integer'</tt> </tt>
<a name="L59"></a><tt class="py-lineno">59</tt>  <tt class="py-line"> </tt>
<a name="L60"></a><tt class="py-lineno">60</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">l</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L61"></a><tt class="py-lineno">61</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">,</tt> <tt class="py-string">'the input must be greater than 0'</tt> </tt>
<a name="L62"></a><tt class="py-lineno">62</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<a name="L63"></a><tt class="py-lineno">63</tt>  <tt class="py-line">    <tt class="py-keyword">while</tt> <tt class="py-name">l</tt><tt class="py-op">:</tt> </tt>
<a name="L64"></a><tt class="py-lineno">64</tt>  <tt class="py-line">        <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">s</tt> <tt class="py-op">+</tt> <tt class="py-name">chr</tt><tt class="py-op">(</tt><tt class="py-name">l</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">255L</tt><tt class="py-op">)</tt> </tt>
<a name="L65"></a><tt class="py-lineno">65</tt>  <tt class="py-line">        <tt class="py-name">l</tt> <tt class="py-op">&gt;&gt;=</tt> <tt class="py-number">8</tt> </tt>
<a name="L66"></a><tt class="py-lineno">66</tt>  <tt class="py-line"> </tt>
<a name="L67"></a><tt class="py-lineno">67</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">s</tt> </tt>
</div><a name="L68"></a><tt class="py-lineno">68</tt>  <tt class="py-line"> </tt>
<a name="str2long"></a><div id="str2long-def"><a name="L69"></a><tt class="py-lineno">69</tt> <a class="py-toggle" href="#" id="str2long-toggle" onclick="return toggle('str2long');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="misc-module.html#str2long">str2long</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="str2long-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="str2long-expanded"><a name="L70"></a><tt class="py-lineno">70</tt>  <tt class="py-line">    <tt class="py-docstring">"""Convert a string to a long integer."""</tt> </tt>
<a name="L71"></a><tt class="py-lineno">71</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt id="link-23" class="py-name"><a title="dvm.MAP_ITEM_NAMEDTUPLE.type" class="py-name" href="#" onclick="return doclink('link-23', 'type', 'link-22');">type</a></tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-op">(</tt><tt class="py-name">types</tt><tt class="py-op">.</tt><tt class="py-name">StringType</tt><tt class="py-op">,</tt> <tt class="py-name">types</tt><tt class="py-op">.</tt><tt class="py-name">UnicodeType</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L72"></a><tt class="py-lineno">72</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">,</tt> <tt class="py-string">'the input must be a string'</tt> </tt>
<a name="L73"></a><tt class="py-lineno">73</tt>  <tt class="py-line"> </tt>
<a name="L74"></a><tt class="py-lineno">74</tt>  <tt class="py-line">    <tt class="py-name">l</tt> <tt class="py-op">=</tt> <tt class="py-number">0L</tt> </tt>
<a name="L75"></a><tt class="py-lineno">75</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt id="link-24" class="py-name" targets="Variable analysis.i=analysis-module.html#i,Variable jvm.i=jvm-module.html#i"><a title="analysis.i
jvm.i" class="py-name" href="#" onclick="return doclink('link-24', 'i', 'link-24');">i</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">s</tt><tt class="py-op">:</tt> </tt>
<a name="L76"></a><tt class="py-lineno">76</tt>  <tt class="py-line">        <tt class="py-name">l</tt> <tt class="py-op">&lt;&lt;=</tt> <tt class="py-number">8</tt> </tt>
<a name="L77"></a><tt class="py-lineno">77</tt>  <tt class="py-line">        <tt class="py-name">l</tt> <tt class="py-op">|=</tt> <tt class="py-name">ord</tt><tt class="py-op">(</tt><tt id="link-25" class="py-name"><a title="analysis.i
jvm.i" class="py-name" href="#" onclick="return doclink('link-25', 'i', 'link-24');">i</a></tt><tt class="py-op">)</tt> </tt>
<a name="L78"></a><tt class="py-lineno">78</tt>  <tt class="py-line"> </tt>
<a name="L79"></a><tt class="py-lineno">79</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">l</tt> </tt>
</div><a name="L80"></a><tt class="py-lineno">80</tt>  <tt class="py-line"> </tt>
<a name="random_string"></a><div id="random_string-def"><a name="L81"></a><tt class="py-lineno">81</tt> <a class="py-toggle" href="#" id="random_string-toggle" onclick="return toggle('random_string');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="misc-module.html#random_string">random_string</a><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
</div><div id="random_string-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="random_string-expanded"><a name="L82"></a><tt class="py-lineno">82</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">random</tt><tt class="py-op">.</tt><tt class="py-name">choice</tt><tt class="py-op">(</tt> <tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">letters</tt> <tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt> <tt class="py-name">random</tt><tt class="py-op">.</tt><tt class="py-name">choice</tt><tt class="py-op">(</tt><tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">letters</tt> <tt class="py-op">+</tt> <tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">digits</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt id="link-26" class="py-name"><a title="analysis.i
jvm.i" class="py-name" href="#" onclick="return doclink('link-26', 'i', 'link-24');">i</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-number">10</tt> <tt class="py-op">-</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt> <tt class="py-op">]</tt> <tt class="py-op">)</tt> </tt>
</div><a name="L83"></a><tt class="py-lineno">83</tt>  <tt class="py-line"> </tt>
<a name="is_android"></a><div id="is_android-def"><a name="L84"></a><tt class="py-lineno">84</tt> <a class="py-toggle" href="#" id="is_android-toggle" onclick="return toggle('is_android');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="misc-module.html#is_android">is_android</a><tt class="py-op">(</tt><tt class="py-param">real_filename</tt><tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
</div><div id="is_android-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="is_android-expanded"><a name="L85"></a><tt class="py-lineno">85</tt>  <tt class="py-line">    <tt class="py-name">fd</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt> <tt class="py-name">real_filename</tt><tt class="py-op">,</tt> <tt class="py-string">"r"</tt><tt class="py-op">)</tt> </tt>
<a name="L86"></a><tt class="py-lineno">86</tt>  <tt class="py-line">    <tt class="py-name">val</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L87"></a><tt class="py-lineno">87</tt>  <tt class="py-line"> </tt>
<a name="L88"></a><tt class="py-lineno">88</tt>  <tt class="py-line">    <tt class="py-name">f_bytes</tt> <tt class="py-op">=</tt> <tt class="py-name">fd</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Method apk.ChilkatZip.read()=apk.ChilkatZip-class.html#read,Method bytecode.BuffHandle.read()=bytecode.BuffHandle-class.html#read,Method bytecode._Bytecode.read()=bytecode._Bytecode-class.html#read"><a title="apk.ChilkatZip.read
bytecode.BuffHandle.read
bytecode._Bytecode.read" class="py-name" href="#" onclick="return doclink('link-27', 'read', 'link-27');">read</a></tt><tt class="py-op">(</tt><tt class="py-number">3</tt><tt class="py-op">)</tt> </tt>
<a name="L89"></a><tt class="py-lineno">89</tt>  <tt class="py-line"> </tt>
<a name="L90"></a><tt class="py-lineno">90</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">f_bytes</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-string">"PK"</tt> <tt class="py-op">:</tt> </tt>
<a name="L91"></a><tt class="py-lineno">91</tt>  <tt class="py-line">        <tt class="py-name">val</tt> <tt class="py-op">=</tt> <tt class="py-string">"APK"</tt> </tt>
<a name="L92"></a><tt class="py-lineno">92</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">f_bytes</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-string">"dex"</tt> <tt class="py-op">:</tt> </tt>
<a name="L93"></a><tt class="py-lineno">93</tt>  <tt class="py-line">        <tt class="py-name">val</tt> <tt class="py-op">=</tt> <tt class="py-string">"DEX"</tt> </tt>
<a name="L94"></a><tt class="py-lineno">94</tt>  <tt class="py-line"> </tt>
<a name="L95"></a><tt class="py-lineno">95</tt>  <tt class="py-line">    <tt class="py-name">fd</tt><tt class="py-op">.</tt><tt class="py-name">close</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L96"></a><tt class="py-lineno">96</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">val</tt> </tt>
</div><a name="L97"></a><tt class="py-lineno">97</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/androguard/">Androguard</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Wed May 18 15:57:06 2011
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
